﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;


namespace 人事工资管理系统
{
    public partial class frmChangeUserRedeploy : Form
    {
        public frmChangeUserRedeploy()
        {
            InitializeComponent();
        }
         PMSClass.DBOperate operate = new PMSClass.DBOperate();
         SqlConnection conn = PMSClass.DBConnection.MyConnection();
        public string Uid;
       
        private void frmChangeUserRedeploy_Load(object sender, EventArgs e)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("select * from tb_redeploy", conn);
            SqlDataReader sdr = cmd.ExecuteReader();
            while (sdr.Read())
            {
                comboBox1.Items.Add(sdr["Uid"].ToString());
            }
            sdr.Close();
            conn.Close();
            operate.BindDropdownlist("tb_redeploy", comboBox1, 1);
            string sql = "select * from tb_redeploy where UID='" +Uid + "'";
            DataSet ds = operate.GetTable(sql);
            ds.Dispose();
            textBox2.Text = ds.Tables[0].Rows[0][2].ToString();
            textBox3.Text= ds.Tables[0].Rows[0][3].ToString();
            textBox4.Text = ds.Tables[0].Rows[0][4].ToString();
            textBox5.Text = ds.Tables[0].Rows[0][5].ToString();
            textBox6.Text = ds.Tables[0].Rows[0][6].ToString();
            textBox7.Text = ds.Tables[0].Rows[0][7].ToString();
            textBox8.Text = ds.Tables[0].Rows[0][8].ToString();
            textBox9.Text = ds.Tables[0].Rows[0][9].ToString();
            textBox10.Text = ds.Tables[0].Rows[0][10].ToString();
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            string strUpdateSql = "update tb_redeploy set UID='" + comboBox1.Text + "',UName='" + textBox2.Text + "',URemoveDate='" + textBox3.Text + "',UOldDep='" + textBox4.Text + "',UNewDep'" + textBox5.Text + "',UOldJob'" + textBox6.Text + "',UNewJob'" + textBox7.Text + "',UOldPay'" + textBox8.Text +
                "',UNewPay'" + textBox9.Text + "'UPayExplain'"+textBox10.Text+"'where UID='" + Uid + "'";
            operate.OperateData(strUpdateSql);
            MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
}
